#ifndef TUNEMANUALFRAME_H
#define TUNEMANUALFRAME_H

#include <QFrame>
#include <QMenu>
#include <QTableWidgetItem>
#include "myslide.h"
#include "analytedatabase.h"
#include "experiment.h"
#include "tunemanual.h"
#include "myqwtplot.h"
#include "sourcemanage.h"

namespace Ui {
class TuneManualFrame;
}

class TuneManualFrame : public QFrame
{
    Q_OBJECT
    
public:
    explicit TuneManualFrame(QWidget *parent = 0);
    ~TuneManualFrame();
    
    void LoadData();//scanPara
    void SaveData();//scanPara

    void LoadTunePara();//
    void SaveTunePara();

private slots:
    void on_pushButton_Load_clicked();//tunepara
    void on_pushButton_Save_clicked();//tunepara

    void on_tableWidget_Hop_itemChanged(QTableWidgetItem *item);
    void on_tableWidget_Sweep_itemChanged(QTableWidgetItem *item);
    void OnTableWidgetHopItemPress(QTableWidgetItem *item);
    void OnTableWidgetSweepItemPress(QTableWidgetItem *item);

    void OnCustomContextMenuRequested(const QPoint &pos);

    void OnTabScanCurrentChanged(int);

    void on_actionDel_triggered();
    void on_actionAdd_triggered();

    void OnAddEle(double,QString);

    void on_pushButton_Scan_clicked();
    void on_pushButton_Stop_clicked();

    void OnPlotTypeChanged(int );

    void OnStateChanged(QString str);
    void UpdateTuneValue(WorkStep);
    void UpdateTuneResult(QList<ExpRawData>);
    void OnFlowStepChanged();

    void OnTuneParaSet();
private:
    Ui::TuneManualFrame *ui;
    MySlide *pMySlide1;
    MySlide *pMySlide2;
    MySlide *pMySlide3;
    MySlide *pMySlide4;
    MySlide *pMySlide5;
    MySlide *pMySlide6;
    MySlide *pMySlide7;
    MySlide *pMySlide8;

    MySlide *pMySlide11;
    MySlide *pMySlide12;
    MySlide *pMySlide13;
    MySlide *pMySlide14;
    MySlide *pMySlide15;
    MySlide *pMySlide16;
    MySlide *pMySlide17;
    MySlide *pMySlide18;
    MySlide *pMySlide19;

    MySlide *pMySlide21;
    MySlide *pMySlide22;
    MySlide *pMySlide23;

    MySlide *pMySlide31;
    MySlide *pMySlide32;
    MySlide *pMySlide33;
    MySlide *pMySlide34;
    MySlide *pMySlide35;
    MySlide *pMySlide36;
    MySlide *pMySlide37;


    TuneResult *pTuneResult;
    TuneManual *pTuneManual;
    NetDealwith *pNetDealwith;
    QMenu *pMenu;
    int menuType;//0:hop 1:sweep
    int scanType;//0:hop 1:sweep
    int plotType;//0:质谱图 1:趋势图 2:分辨率

    //data
    QList<QList<double> > DatassTemp;//cps rsd
    QList<ExpRawData> rawDatas;//sample
    QList<QList<double> > trendDatass;//(序号，趋势数据)

    //plot item
    QList <QwtPlotCurve *> curves;//

    MyQwtPlot *pQwtPlotSpectral1;//质谱图 massCurves
    MyQwtPlot *pQwtPlotSpectral2;//趋势图 trendCurves
    MyQwtPlot *pQwtPlotSpectral3;//分辨率图 resolutionCurves

    void UpdateResolutionPlot();

    void EnableTunePara(bool);
    void EnableScanPara(bool);
};

#endif // TUNEMANUALFRAME_H
